<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>屏幕共享服务中...</title>
    <style>
        .container {
            display: grid;
            place-items: center;
            height: 100vh;
        }
        /* 默认样式 */
        img {
            max-width: 100%;
            height: auto;
        }

        /* 横屏样式 */
        @media (orientation: landscape) {
            img {
                width: 100%;
                height: auto;
            }
        }

        /* 竖屏样式 */
        @media (orientation: portrait) {
            img {
                width: 100%;
                height: auto;
            }
        }

        /* 全屏样式 */
        @media (fullscreen) {
            img {
                width: 100%;
                height: auto;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <img src="/stream" alt="屏幕共享" />
    </div>
    <script>
        // 监听全屏事件
        document.addEventListener('fullscreenchange', function() {
            const img = document.querySelector('img');
            if (document.fullscreenElement) {
                img.style.width = '100%';
                img.style.height = 'auto';
            } else {
                img.style.width = 'auto';
                img.style.height = 'auto';
            }
        });
    </script>
</body> 
</html>